import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
// import locale from 'element-ui/lib/locale/lang/en' // lang i18n

import checkPermission from '@/utils/mixin' // 按钮权限

import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'
import * as directives from '@/directives'
import * as filters from '@/filters' // 引入工具类
import i18n from '@/lang' // lang i18n
import '@/icons' // icon
import '@/permission' // permission control
import Print from 'vue-print-nb' // 利用vue-print-nb进行打印
import Component from '@/components'
Vue.use(Component) // 注册自己的插件

Vue.use(Print)
Vue.mixin(checkPermission)
// set ElementUI lang to EN
// Vue.use(ElementUI, { locale })
// 如果想要中文版 element-ui，按如下方式声明
// Vue.use(ElementUI)
// 设置element为当前的语言
Vue.use(ElementUI, {
  i18n: (key, value) => i18n.t(key, value)
})

Object.keys(directives).forEach(key => {
  Vue.directive(key, directives[key])
})
// 注册全局的过滤器
Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key]) // 注册过滤器
})

Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  store,
  i18n, // 添加这一行  没有这一行   Vue全局的实例上没有$t
  render: h => h(App)
})
